services:
  agent:
    command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.pipeline_config=assistant_dists/dream_multilingual/pipeline_conf.json'
    environment:
      WAIT_HOSTS: "convers-evaluation-selector:8009, 
          gpt2-multilingual:8132, toxic-classification-multilingual:8013,
          sentiment-classification-multilingual:8024, sentence-ranker-multilingual:8128"
      WAIT_HOSTS_TIMEOUT: ${WAIT_TIMEOUT:-1200}
      HIGH_PRIORITY_INTENTS: 1
      RESTRICTION_FOR_SENSITIVE_CASE: 1
      ALWAYS_TURN_ON_ALL_SKILLS: 0
      LANGUAGE: EN
      FALLBACK_FILE: fallbacks_dream_en.json

  convers-evaluation-selector:
    env_file: [ .env ]
    build:
      args:
        TAG_BASED_SELECTION: 1
        CALL_BY_NAME_PROBABILITY: 0.5
        PROMPT_PROBA: 0.1
        ACKNOWLEDGEMENT_PROBA: 0.3
        PRIORITIZE_WITH_REQUIRED_ACT: 0
        PRIORITIZE_NO_DIALOG_BREAKDOWN: 0
        PRIORITIZE_WITH_SAME_TOPIC_ENTITY: 0
        IGNORE_DISLIKED_SKILLS: 0
        GREETING_FIRST: 1
        RESTRICTION_FOR_SENSITIVE_CASE: 1
        PRIORITIZE_PROMTS_WHEN_NO_SCRIPTS: 1
        MAX_TURNS_WITHOUT_SCRIPTS: 7
        ADD_ACKNOWLEDGMENTS_IF_POSSIBLE: 1
        PRIORITIZE_SCRIPTED_SKILLS: 0
        CONFIDENCE_STRENGTH: 0.8
        CONV_EVAL_STRENGTH: 0.4
        PRIORITIZE_HUMAN_INITIATIVE: 1
        QUESTION_TO_QUESTION_DOWNSCORE_COEF: 0.8
        LANGUAGE: EN
        FALLBACK_FILE: fallbacks_dream_en.json
      context: .
      dockerfile: ./response_selectors/convers_evaluation_based_selector/Dockerfile
    command: flask run -h 0.0.0.0 -p 8009
    environment:
      - FLASK_APP=server
    deploy:
      resources:
        limits:
          memory: 100M
        reservations:
          memory: 100M

  gpt2-multilingual:
    env_file: [ .env ]
    build:
      args:
        SERVICE_PORT: 8132
        SERVICE_NAME: gpt2_generator
        CONFIG_NAME: mgpt.json
        PRETRAINED_MODEL_NAME_OR_PATH: sberbank-ai/mGPT
        N_HYPOTHESES_TO_GENERATE: 3
        MAX_HISTORY_DEPTH: 3
      context: ./services/gpt2_generator/
    command: flask run -h 0.0.0.0 -p 8132
    environment:
      - CUDA_VISIBLE_DEVICES=0
      - FLASK_APP=server
    deploy:
      resources:
        limits:
          memory: 6G
        reservations:
          memory: 6G

  toxic-classification-multilingual:
    env_file: [ .env ]
    build:
      args:
        SERVICE_PORT: 8013
        SERVICE_NAME: toxic_classification
        PRETRAINED_MODEL_NAME_OR_PATH: https://github.com/unitaryai/detoxify/releases/download/v0.4-alpha/multilingual_debiased-0b549669.ckpt
      context: ./annotators/MultilingualToxicClassification/
    command: flask run -h 0.0.0.0 -p 8013
    environment:
      - CUDA_VISIBLE_DEVICES=0
      - FLASK_APP=server
    deploy:
      resources:
        limits:
          memory: 3.5G
        reservations:
          memory: 3.5G

  sentiment-classification-multilingual:
    env_file: [ .env ]
    build:
      args:
        SERVICE_PORT: 8024
        SERVICE_NAME: sentiment_classification
        PRETRAINED_MODEL_NAME_OR_PATH: cardiffnlp/twitter-xlm-roberta-base-sentiment
      context: ./annotators/MultilingualSentimentClassification/
    command: flask run -h 0.0.0.0 -p 8024
    environment:
      - CUDA_VISIBLE_DEVICES=0
      - FLASK_APP=server
    deploy:
      resources:
        limits:
          memory: 3.5G
        reservations:
          memory: 3.5G

  sentence-ranker-multilingual:
    env_file: [ .env ]
    build:
      args:
        SERVICE_PORT: 8128
        PRETRAINED_MODEL_NAME_OR_PATH: DeepPavlov/bert-base-multilingual-cased-sentence
      context: ./services/sentence_ranker/
    command: flask run -h 0.0.0.0 -p 8128
    environment:
      - CUDA_VISIBLE_DEVICES=0
      - FLASK_APP=server
    deploy:
      resources:
        limits:
          memory: 3G
        reservations:
          memory: 3G

version: '3.7'
